package com.weita.lightfood.model.dao;


import com.weita.lightfood.model.entity.Address;
import com.weita.lightfood.model.entity.School;
import com.weita.lightfood.model.query.address.AddAddrQuery;
import com.weita.lightfood.model.query.address.UpdateAddrQuery;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author IT_Monster at 2019/04/12 13:21.
 * 地址mapper接口
 */
@Mapper
@Repository
public interface AddressDao {

    /**
     * 添加地址
     * @param addAddrQuery
     * @throws Exception
     */
    void addAddress(AddAddrQuery addAddrQuery) throws Exception;

    /**
     * 删除地址
     * @param addressId
     * @throws Exception
     */
    void deleteAddress(int addressId) throws Exception;

    /**
     * 修改地址
     * @param updateAddrQuery
     * @throws Exception
     */
    void updateAddress(UpdateAddrQuery updateAddrQuery) throws Exception;

    /**
     * 查询用户所有地址
     * @param userId
     * @return
     * @throws Exception
     */
    List<Address> getAddress(int userId) throws Exception;

    /**
     * 获取学校
     * @return
     * @throws Exception
     */
    List<School> getSchools() throws Exception;

    /**
     * 通过地址id获取地址
     * @param addressId
     * @return
     * @throws Exception
     */
    Address getAddressById(int addressId) throws Exception;
}
